package cn.iinda.electronicInfo.controller;

import cn.iinda.electronicInfo.model.ElectronicFilmResult;
import cn.iinda.electronicInfo.service.ElectronicInfoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version V3.0
 * @Title: ElectronicInfoController
 * @Company: 成都影达科技有限公司
 * @Description: 描述
 * @author: 东进
 * @date 2018-01-26 10:09
 */
@Api(value = "ElectronicInfoController", description = "电子胶片相关api")
@RestController
public class ElectronicInfoController {

    @Autowired
    private ElectronicInfoService electronicInfoService;

    @ApiOperation(value = "通过姓名查找", notes = "测试数据：从")
    @GetMapping("findElectronicInfoByName/{name}")
    public ElectronicFilmResult findElectronicInfoByName(@PathVariable String name) {
        ElectronicFilmResult result = electronicInfoService.findByPatientName(name);
        return result;
    }

    @ApiOperation(value = "通过电话号码查询", notes = "测试数据无")
    @GetMapping("findElectronicInfoByPhone/{phoneNum}")
    public ElectronicFilmResult findElectronicInfoByPhone(@PathVariable String phoneNum) {
        ElectronicFilmResult result = electronicInfoService.findByPhoneNum(phoneNum);
        return result;
    }

    @ApiOperation(value = "通过id查询", notes = "测试数据:904")
    @GetMapping("findElectronicInfoById/{id}")
    public ElectronicFilmResult findElectronicInfoById(@PathVariable Integer id) {
        ElectronicFilmResult result = electronicInfoService.findById(id);
        return result;
    }

    @ApiOperation(value = "通过id查询", notes = "测试数据:2694")
    @GetMapping("findDicomCountByStudyId/{studyId}")
    public ElectronicFilmResult findDicomCountByStudyId(@PathVariable Integer studyId) {
        ElectronicFilmResult result = electronicInfoService.getDicomCount(studyId);
        return result;
    }

    @ApiOperation(value = "通过StudyId查询dicomdata数据", notes = "")
    @GetMapping("findDicomdataByStudyinfoid/{studyId}")
    public ElectronicFilmResult findDicomdataByStudyinfoid(@PathVariable Integer studyId) {
        ElectronicFilmResult result = electronicInfoService.findDicomdataByStudyId(studyId);
        return result;
    }

    @ApiOperation(value = "通过ResultId查询dicomJpg数据", notes = "测试数据:904")
    @GetMapping("findDicomJpgByResultId/{resultId}")
    public ElectronicFilmResult findDicomJpgByResultId(@PathVariable Integer resultId) {
        ElectronicFilmResult result = electronicInfoService.findJpgByResultId(resultId);
        return result;
    }

    @ApiOperation(value = "通过PatientNum查询电子胶片信息", notes = "")
    @GetMapping("findInfoByPatientNum/{patientNum}")
    public ElectronicFilmResult findInfoByPatientNum(@PathVariable String patientNum) {
        ElectronicFilmResult result = electronicInfoService.findByPatientNum(patientNum);
        return result;
    }
}
